<?php


namespace App\Http\Controllers;


use App\Models\Models\XxPushCode;
use App\Models\PushUser;

class CheckPushUserController extends Controller
{
    /**
     * 查询父级账户信息
     * @param $push_account
     */
    public function find($push_account)
    {
        $pushUser = PushUser::select('push_user.id', 'a.bind_push_id')
            ->where('push_user.phone', $push_account)
            ->leftJoin('push_code as a', 'a.push_id', '=', 'push_user.id')
            ->first();
        if (!empty($pushUser)) {
            if (!empty($pushUser) && $pushUser->bind_push_id > 0) {
                $masterPushUser = PushUser::where('id', $pushUser->bind_push_id)->first();
                return response()->json($masterPushUser);
            }
        }
        return response()->json(['status' => -1]);
    }
}
